
// iRec Universal App //

/// Developed by theMagHimself ///

// Created at mag Design Studio //

#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioQueue.h>
#import <AudioToolbox/AudioFile.h>

#define NUM_BUFFERS 3
#define kAudioConverterPropertyMaximumOutputPacketSize		'xops'
#define DOCUMENTS_FOLDER [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]

typedef struct
	{
		AudioFileID                 audioFile;
		AudioStreamBasicDescription dataFormat;
		AudioQueueRef               queue;
		AudioQueueBufferRef         buffers[NUM_BUFFERS];
		UInt32                      bufferByteSize; 
		SInt64                      currentPacket;
		BOOL                        recording;
	} RecordState;

@interface Recorder : NSObject {
	RecordState recordState;
}

@property (nonatomic, readonly) BOOL isRecording;
@property (nonatomic, readonly) CGFloat averagePower;
@property (nonatomic, readonly) CGFloat peakPower;
@property (nonatomic, readonly) NSTimeInterval currentTime;

- (BOOL)	startRecording: (NSString *) filePath;
- (void)	stopRecording;
- (void)	pause;
- (BOOL)	resume;
@end
